<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
${aier_doctype}
<html <s:property value="aier_html_xmlns" escape="false"/>>
<head>
<meta http-equiv="Content-Type" content="${aier_content_type}" />
<meta name="keywords" content="${aier_keyworks}" />
<meta name="description" content="${aier_description}" />
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}ui.css" />
<link href="${aier_css_url}jq/jq.css" rel="Stylesheet" />
<link rel="stylesheet" href="${aier_css_url}social/module/jq-msg.css" />

<script type="text/javascript" src="${aier_js_url}j.js"></script>
<script type="text/javascript" src="${aier_js_url}b.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/hh/ui.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/msg.js"></script>
<script type="text/javascript" src="${aier_js_url}97/WdatePicker.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/cn.js"></script> 
<script type="text/javascript" src="${aier_js_url}jq/jq.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	$("#schoolinfo").jqGrid({      
			url:"${aier_url}${aier_urijs}searchschool_selSc_load${aier_suffix}?pid=${pid}",                
			datatype:"json",                
			mtype:'GET', 
			//getData:{'ruid':-1}, 
			width:'800',   
			height:'300',   
			colNames:['学校名称','管理员','操作','sid'],                
			colModel:[                    
			{name:'name',index:'name',width:250,align:'center', sortable:false},    
			{name:'managers',index:'managers',width:250,align:'center', sortable:false},
			{name:'option',index:'option',width:250,align:'center', sortable:false},
			{name:'sid',index:'sid',hidden:true}                
			],
			//getData:{"ichead":"","icbodyMin":"","icbodyMax":"","assigncard_mark":null,},
			//autowidth:true,
			jsonReader: {
				root: "schoolsList",
				page: "page",
				total: "page_count",
				records : "count",
				repeatitems: false
			},
			pager: jQuery("#schoolpage"),
			prmNames : {page:"page",sort: "sort"},
			rowNum: 10,
			//rowList: [10, 20, 30],
			sortname: 'name',
			hidegrid: false,
			sortorder: 'asc',
			viewrecords: true,
			caption: '学校信息',
			gridComplete:function(){
				var ids=jQuery("#schoolinfo").jqGrid('getDataIDs');
				for(var i=0; i<ids.length; i++){
					var id=ids[i];   
					ma = "<a href='javascript:;' class='jqtrow' onclick='addTel(" + id + ")'>添加学校管理员</a>"; 
					jQuery("#schoolinfo").jqGrid('setRowData', ids[i], { option: ma });
				}
			}
		}).navGrid("#schoolpage", { edit: false, add: false, del: false, search: false });
});

function addTel(id){
	var sid = jQuery("#schoolinfo").jqGrid('getRowData', id).sid;
	$("#d_schoolmanageadd").dialog({
		//背景变暗
		modal: true,
		autoOpen : false,
		show : "blind",
		//hide : "explode",
		width : "435",
		height : "200",
			buttons: {
				"添加": function() {
				var account = $("#txt_newAccount").val().trim();
				if(account==""){
					$().message("请输入账号");
					return
				}
				var fun = function(data) {
					if(1==data.s){
						$().message("添加成功,您可以继续添加!");
						$("#schoolinfo").trigger("reloadGrid");
					}else{
						$().message("添加失败!"+data.error_info);
					}
				};
				exeAjax(ajaxUrl("${aier_url}${aier_urijs}searchschool_addSchoolManage${aier_suffix}?pid=${pid}"), fun, 
					{"sid" : sid,"account" :account});
					
				},"取消": function() {
					$( this ).dialog( "close" );
				}
			}
	});
	$("#d_schoolmanageadd").dialog("open");

}
</script>
</head>
<body>
	<div id="tabs">
		<ul>
			<li><a href="#tabs-1">查询学校</a></li>
		</ul>
		<div id="tabs-1" style="height: 500px;">
			<div class="d_content">
				<!-- <div data-label="学校地址" class="d_scnOut">
					<div class="d_scname">
						<label>选择区域:</label>
					</div>
					<div class="sel_region">
						<select>
							<option>请选择</option>
							<option>江苏</option>
						</select> <select>
							<option>请选择</option>
							<option>常州</option>
						</select> <select>
							<option>请选择</option>
							<option>武进</option>
						</select> <select>
							<option>请选择</option>
							<option>湖塘</option>
						</select>
					</div>
				</div>
				<div data-label="学校名称" class="d_scnOut">
					<div class="d_scname">
						<label for="txt_scName">学校名称:</label>
					</div>
					<div class="d_sctext">
						<input type="text" id="txt_scName" class="txt_scname">
					</div>
				</div>
				 -->
				<!-- 表格数据 -->
				<table id="schoolinfo"></table>
				<div id="schoolpage"></div>
			</div>
		</div>
	</div>
	<!-- 弹出层添加学校管理员 -->
	<div id="d_schoolmanageadd" style="display: none;" title="添加学校管理员">
		<div class="info-tab01">
			<table>
				<tbody>
					<tr>
						<th class="d_scname">账户：</th>
						<td>
							<input type="text" id="txt_newAccount" class="txt_scname">
						</td>
					</tr>
				</tbody>
			</table>
		</div>

	</div>
</body>
<script type="text/javascript">
	$("#tabs").tabs();


</script>
</html>